<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	    <meta name="author" content="hexinyang">	
		<title>灰名单管理</title>
		<script language="javascript" type="text/javascript" src="../script/common.js"></script>
		<script language="javascript" type="text/javascript">		
		//数据表格对象
		var qt = null;
		//页面加载方法				
		function load(){
			Eui.showNavigation();  
			setPages(["listview","grayview"]);
			Eui.initBeginDateInput("beginDateTd","起始日期","searchForm","beginDate","endDate","_pastDate");
			Eui.initEndDateInput("endDateTd","结束日期","searchForm","beginDate","endDate","_pastDate");
			var list = [];
	   			var card_type = Common.getItems("base_card_type");
	   			for (var i = 0;i<card_type.length;i++){
	   				var d = card_type[i];
					if(d.code==BaseCardType.PERSONAL||d.code==BaseCardType.COMPANY)
						list.push(d);
	  			}
				Common.initDict(searchForm.cardType,list,"全 部");		//初始化字典

			createTable();
		}
		//创建灰名单表格对象      	
		function createTable(){
		    var columns = [];
			columns[10] = {title:"操作",width:10,order:false,render:deleteFunc};				
			qt = new QueryTable("gray","searchForm","datalist",columns);
			}
		//刷新灰名单表格
		function showData(){
			qt.showTable();
		}
		//解灰方法
		function deleteFunc(v,r){
			return "<a href=# onclick=\"part('"+r[8]+"');return false;\">明细<\/a>"
		}
		//进入灰名单明细页面
		function part(c){
			DWR.call("grayTradeService.getGrayInfo",c,function(v){
				if(v.grayTrade.occurTime){													//格式化时间
					v.occurTime = v.grayTrade.occurTime.format("yyyy-MM-dd hh:mm:ss");
				}
				if(v.grayTrade.recordTime){													//格式化时间
					v.recordTime = v.grayTrade.recordTime.format("yyyy-MM-dd hh:mm:ss");
				}
				
				v.accountTypeText = Common.getText("account_type",v.grayTrade.accountType);
				v.unitText = Common.getText("account_unit",v.grayTrade.accountType);
				if(v.grayTrade.amount){
					v.amount = Format.fenToYuan(v.grayTrade.amount);
				}
				v.asn = v.grayTrade.cardAsn;
				if(v.acquirer){
					v.acquirerName = v.acquirer.name;					
				}

				Common.showDetail("grayform",v);									//初始化明细表单
				switchPage("grayview");
			},{blockScreen:true});			
		}
		//解灰方法
		function changedelete(asn){
			if(showQuestion("是否确认解除灰交易?")){
				DWR.call("cardMgntService.delGray",asn,function(v){	
					showInformation(" 解灰成功！");	
					showData();	
				});		
			}		
		}
		
		function selShowData(){
			if(searchForm.upper_limit.value){
				searchForm.selupper_limit.value = Format.yuanToFen(searchForm.upper_limit.value);			
			}
			if(searchForm.floor_level.value){
				searchForm.selfloor_level.value = Format.yuanToFen(searchForm.floor_level.value);			
			}
			showData();
		}
		</script>
	</head>	
	<body onload="load()">
		<!--页面导航-->
		<div class="nav"><div id="nav">&nbsp;</div></div>
		<!--页面导航-->
		<div id="listview">
			<form id="searchForm" name="searchForm">
				<div class="searchForm">
					<table width="100%" cellspacing="0" cellpadding="4" border="0"  class="label5">
						<tr>
						
							<td><label>卡&nbsp;&nbsp;&nbsp;&nbsp;号&nbsp;&nbsp;</label> <input type="text" name="asn" onBlur="checkV(this,'asn')"></td>
							<td><label>客户证件号</label> <input type="text" name="certificateNumber" onBlur="checkV(this,'99')"></td>
							<td><label>卡片类型</label> <select name="cardType"><option></option></select></td>
						</tr>
						<tr>                                                                                                                                                                       
							<td><label>灰金额上限</label> <input type="text" name="upper_limit" onBlur="checkV(this,'positiveAmount')"><input type="hidden" name="selupper_limit"> 元</td>
							<td><label>灰金额下限</label> <input type="text" name="floor_level" onBlur="checkV(this,'positiveAmount')"><input type="hidden" name="selfloor_level"> 元</td>
							<td>&nbsp;</td>
						</tr>
						<tr>				
							<td id="beginDateTd">&nbsp;</td>	
							<td id="endDateTd">&nbsp;</td>										
							<td><button type="button" onClick="selShowData()">查 询</button></td>
						</tr>
					</table>
				</div>
			</form>
			<div id="datalist"></div>
		</div>
		<div id="grayview" style="display:none;">
			<form id="grayform" name="grayform">
				<div class="form">
					<div class="formTitle">灰交易信息</div>
					<table cellSpacing="0" cellPadding="4" width="100%" border="0" class="label5 viewTable">
						<tr>
							<td><label>卡&nbsp;&nbsp;&nbsp;&nbsp;号</label> <span id="asn"></span></td>
							<td><label>帐户类型</label> <span id="accountTypeText"></span></td>
						</tr>	
						<tr>
							<td><label>灰交易额</label> <span id="amount"></span></td>
							<td><label>单&nbsp;&nbsp;&nbsp;&nbsp;位</label> <span id="unitText"></span></td>
						</tr>	
						<tr>
							<td><label>灰交易时间</label> <span id="occurTime"></span></td>
							<td><label>加油站名称</label> <span id="acquirerName"></span></td>
						</tr>	
						<tr>
							<td><label>入账时间</label> <span id="recordTime"></span></td>
							<td>&nbsp;</td>
						</tr>	
					</table>
				</div>
				<p><button type="button" onclick="switchPage('listview')">返 回</button></p>
			</form>
		</div>
	</body>
</html>